#include<iostream>
#include<string>
using namespace std;
int main1()
{
   string sl("asdyudfshu");
   for(auto i:sl)
   {
    cout << i << " ";
   }
   cout << endl;
}
int main2()
{
    string sl = "asjdfuhsfagui";
    string::iterator i = sl.begin();
    while(i != sl.end())
    {
        cout << *i << " ";
        i++;
    }
    cout << endl;

}
//capacitp
int main3()
{
    string sl("sdffafasfda");
    cout << sl.size() <<endl;
    cout << sl.capacity() <<endl;
    if(sl.empty())
    {
        cout << "true" <<endl;
    }
    else
    {
        cout << "false" <<endl;
    }

    sl.reserve(100);
    sl += "666666666";
    cout << sl.capacity() <<endl;

    for(auto& i : sl)
    {
        cout << i <<" ";
    }
    cout << endl;

    return 0;
}

int main4()
{
    string sl("6666666");
    sl[3] = 'w';
    for(auto& i : sl)
    {
        cout << i << " ";

    }
    cout << endl;
    sl.push_back('w');
    sl.push_back('r');
    sl.push_back('t');

    sl.append("99999");
    sl += "00000000";
    string s2("444444444");
    sl+=s2;
    for(auto& i:sl)
    {
        cout << i << " ";
    }
    cout << endl;

    return 0;
}

int main5()
{
    string sl("445566www8899");
    int i = sl.find('w',0);
    sl[6] = '7';
    string s2 = sl.substr(i,3);
    cout << i << endl;

    for(auto& i :s2)
    {
        cout << i << " ";
    }
    cout << endl;
    return 0;
}

int main6()
{
    string sl("www6666");
    sl.erase(0,3);
    sl += "777777";
    string s2("1111");
    s2 += sl + "9999";
    for(auto& i : s2)
    {
        cout << i;
    }
    cout << endl;
    return 0;
}

int main7()
{
    string s;
    getline(cin,s);
    s += "666";
    for(auto& i : s)
    {
        cout << i ;
    }
    cout << endl;
    return 0;
}

int main8()
{
    string s("2354v 362");
    string s1("www");
    string s2("www");
    cout << (s == s1) <<endl;
    cout << (s1 == s2) <<endl;
    return 0;
}


int main10()
{
    auto i = [](int x,int y){return x+y;};
    cout << i(5,5) <<endl;
}

////////////////////////////////////////////////////////////
#include <functional>

class add
{
public:
    add(int n=10)
        :_n(n)
    {}
    int sub(int x,int y)
    {
        return x-y;
    }
    static hh(int x,int y)
    {
        return x * y;
    }
private:
    int _n;
};

using placeholders::_1;
using placeholders::_2;
using placeholders::_3;

int sub(int x,int y)
{
    return (x - y) * 20;
}

int main()
{
    auto ret = bind(sub,_1,_2);
    cout << ret(10,2) <<endl;
    return 0;
}


int main11()
{
    //function<int(add,int,int)> f1 = &add::sub;
   // function<int(int ,int)> f2 = &add::hh;
   // add sp;
    //cout << f1(sp,10,5) <<endl;
    //cout << f2(5,5) <<endl;

    function<int(int,int)> f1 = &add::hh;
    cout << f1(8,5) << endl;

    function<int(add,int,int)> f2 = &add::sub;
    cout << f2(add(),10,5) << endl;
    return 0;
}
